package com.example.calendar_lib;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

import com.bwie.servicemodule.calendarview.Calendar;
import com.bwie.servicemodule.widget.IndexCalendarView;

public class MainActivity extends AppCompatActivity implements IndexCalendarView.CalendarListener {

    private IndexCalendarView mainCalendar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        init();
        setOperation();
    }

    private void setOperation() {

        mainCalendar.setListener( this);
    }

    private void init() {

        mainCalendar = findViewById(R.id.main_calendar);


    }

    @Override
    public void select(Calendar calendar) {

        String item =  calendar.getYear() + "年" + calendar.getMonth() + "月" + calendar.getDay() + "日";
        Toast.makeText(this, "" + item , Toast.LENGTH_SHORT).show();

    }
}
